import { HTTP } from 'utils/http';
import config from 'utils/config';

// UPDATE_USER_NICK_NAME
// 修改用户昵称
class UpdateUserNickNameModel extends HTTP{
    updateUserNickName(nickName, id) {
        return new Promise((resolve, reject) => {
            this.axiosPost({
                url: config.API.UPDATE_USER_NICK_NAME,
                data: {
                    nickName,
                    id
                },
                success(data) {
                    resolve({
                        data,
                        status: 0
                    });
                },
                error(error) {
                    resolve({
                        error,
                        status: -1
                    })
                }
            });
        })
    }
}

// 修改用户个性签名
class UpdateUserSignatureModel extends HTTP{
    updateUserSignature(signature, id) {
        return new Promise((resolve, reject) => {
            this.axiosPost({
                url: config.API.UPDATE_USER_SIGNATURE,
                data: {
                    signature,
                    id
                },
                success(data) {
                    resolve({
                        data,
                        status: 0
                    });
                },
                error(error) {
                    resolve({
                        error,
                        status: -1
                    })
                }
            });
        })
    }
}

// 修改用户性别
class UpdateUserGenderModel extends HTTP{
    updateUserGender(gender, id) {
        return new Promise((resolve, reject) => {
            this.axiosPost({
                url: config.API.UPDATE_USER_GENDER,
                data: {
                    gender,
                    id
                },
                success(data) {
                    resolve({
                        data,
                        status: 0
                    });
                },
                error(error) {
                    resolve({
                        error,
                        status: -1
                    })
                }
            });
        })
    }
}

// 修改用户头像
class UpdateUserImgModel extends HTTP{
    updateUserImg(imgUrl, id) {
        return new Promise((resolve, reject) => {
            this.axiosPost({
                url: config.API.UPDATE_USER_IMG,
                data: {
                    imgUrl,
                    id
                },
                success(data) {
                    resolve({
                        data,
                        status: 0
                    });
                },
                error(error) {
                    resolve({
                        error,
                        status: -1
                    })
                }
            });
        })
    }
}



export { UpdateUserNickNameModel ,UpdateUserSignatureModel,UpdateUserGenderModel,UpdateUserImgModel};